package antempire.control.game.operation.targetoperation;

import java.util.HashMap;

import org.anddev.andengine.opengl.texture.region.TextureRegion;
import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;
import org.anddev.andengine.ui.activity.BaseGameActivity;

import antempire.control.game.GameConstants;

public class TargetOperation implements GameConstants {

	private TiledTextureRegion pTextureRegion;
	private HashMap<Integer, TextureRegion> allNumberTextureRegionMap;
	TargetSprite targetSprite;

	public TargetOperation(TiledTextureRegion pTextureRegion,
			HashMap<Integer, TextureRegion> allNumberTextureRegionMap) {
		this.pTextureRegion = pTextureRegion;
		this.allNumberTextureRegionMap = allNumberTextureRegionMap;
	}

	public TargetSprite deployTarget(final BaseGameActivity activity,
			int water_level, float speed) {
		

		float pX = (float) Math.random() * (CAMERA_WIDTH - 600) + 300; 
		float pY = (float) Math.random() * (CAMERA_HEIGHT - 400) + 150;

		this.targetSprite = new TargetSprite(pX, pY, pTextureRegion.clone(), allNumberTextureRegionMap.get(water_level), speed,
				activity);
		

		return targetSprite;
	}

	/*public TargetSprite deployTarget(float pX, float pY, float red,
			float green, float blue, final BaseGameActivity activity) {

		this.targetSprite = new TargetSprite(pX, pY, pTextureRegion.clone(),
				activity);
		this.targetSprite.setColor(red, green, blue);

		activity.getEngine().getScene().getChild(LAYER_TARGET)
				.attachChild(targetSprite);

		return targetSprite;
	}*/
}
